<?php
class Application {
	
	private static $instance = null;
	
	private $CI;
	
	public function __construct() {
		if (self::$instance != null) return;
		self::$instance = $this;
		
		$this->CI = &get_instance();
	}
	
	public static function url() {
		return base_url();
	}
	
	public static function resources() {
		return base_url() . 'frontend/';
	}
	
	public static function path() {
		return APPPATH;
	}
	
	public static function get_called_controller() {
		return self::$instance->CI->uri->rsegments[1];
	}
	
	public static function get_called_method() {
		return self::$instance->CI->uri->rsegments[2];
	}
	
	public static function is_request_post() {
		return $_SERVER['REQUEST_METHOD'] == 'POST';
	}
	
	public static function is_request_get() {
		return $_SERVER['REQUEST_METHOD'] == 'GET';
	}
	
	public static function getLang() {
		return self::$instance->CI->config->item('language_short');
	}
	
	public static function load_library($name) {
		self::$instance->CI->load->library($name);
		return self::$instance->CI->$name;
	}
	
}